<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <meta name="renderer" content="webkit">
        <title>
            登录 - SegmentFault
        </title>
        <meta name="description" content="">
        <meta name="keywords" content="">
        <link rel="stylesheet" href="/p201604/seg/seg/Public/css/global.css">
        <link rel="stylesheet" href="/p201604/seg/seg/Public/css/user.css">
        <link rel="stylesheet" href="/p201604/seg/seg/Public/css/responsive.css">
    </head>
    
    <body data-mod="user" class="user-login ">
        <img id="icon4weChat" style="height: 0;width: 0;" data-src="https://sf-static.b0.upaiyun.com/v-57bd4435/global/img/touch-icon-512.png">
        <img id="icon4weChat" data-src="https://sf-static.b0.upaiyun.com/v-57bd4435/global/img/touch-icon-512.png">
        <div class="container">
            <div class="header text-center">
                <h1>
                    <a href="/p201604/seg/seg" class="logo">
                        <img src="/p201604/seg/seg/Public/images/logo-b.svg" alt="SegmentFault">
                    </a>
                </h1>
                <p class="description text-muted">
                    欢迎加入专业的中文开发者社区
                </p>
            </div>
            <div class="row bg-white login">
                <div class="col-md-4 col-sm-12 col-md-push-7 login-wrap">
                    <h1 class="h4 text-muted login-title mb30">
                        用户登录
                    </h1>
                    <form action="<?php echo U('home/login/logon');?>" method="POST" role="form"
                    class="mt30">
                        <div class="form-group">
                            <label for="mail" class="control-label">
                                Email
                            </label>
                            <input type="email" class="form-control" name="mail" required="" placeholder="hello@segmentfault.com" id='dmail'>
                        </div>
                        <div class="form-group">
                            <label for="password" class="control-label">
                                密码
                            </label>
                            <input type="password" class="form-control" name="password" required=""
                            placeholder="密码" id='dpass'>
                        </div>
                        <div class="form-group clearfix">
                            <div class="checkbox pull-left">
                                <label>
                                    <input name="remember" type="checkbox" value="1" checked="">
                                    记住登录状态
                                </label>
                            </div>
                            <button type="submit" class="btn btn-primary pull-right pl20 pr20">
                                登录
                            </button>
                        </div>
                    </form>
                    <p class="h4 text-muted visible-xs-block mb30 hidden-xs">
                        快速登录
                    </p>
                    <div class="widget-login mt30">
                        <p class="text-muted mt5 mr10 pull-left hidden-xs">
                            快速登录
                        </p>
                        <a href="https://segmentfault.com/user/oauth/weixin" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weixin visible-xs hidden">
                            <span class="icon-sn-bg-weixin">
                            </span>
                            <strong class="visible-xs-inline">
                                微信账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/google" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-google visible-xs">
                            <span class="icon-sn-bg-google">
                            </span>
                            <strong class="visible-xs-inline">
                                Google 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/google" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-google hidden-xs">
                            <span class="icon-sn-bg-google">
                            </span>
                            <strong class="visible-xs-inline">
                                Google 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/github" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-github hidden-xs">
                            <span class="icon-sn-bg-github">
                            </span>
                            <strong class="visible-xs-inline">
                                Github 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/github" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-github visible-xs">
                            <span class="icon-sn-bg-github">
                            </span>
                            <strong class="visible-xs-inline">
                                Github 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/weibo" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weibo hidden-xs">
                            <span class="icon-sn-bg-weibo">
                            </span>
                            <strong class="visible-xs-inline">
                                新浪微博账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/qq" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-qq visible-xs">
                            <span class="icon-sn-bg-qq">
                            </span>
                            <strong class="visible-xs-inline">
                                QQ 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/qq" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-qq hidden-xs">
                            <span class="icon-sn-bg-qq">
                            </span>
                            <strong class="visible-xs-inline">
                                QQ 账号
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/weixin" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-weixin hidden-xs">
                            <span class="icon-sn-bg-weixin">
                            </span>
                            <strong class="visible-xs-inline">
                                微信账号
                            </strong>
                        </a>
                        <a id="showMore" href="javascript:;" class="btn pl5 pr5 mb5 btn-default btn-sm btn-sn-dotted">
                            <span class="icon-sn-bg-dotted">
                            </span>
                            <strong class="visible-xs-inline">
                                •••
                            </strong>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/twitter" class="btn pl5 pr5 mb5 btn-default btn-sn-twitter btn-sm hidden">
                            <span class="icon-sn-bg-twitter">
                            </span>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/facebook" class="btn pl5 pr5 mb5 btn-default btn-sn-facebook btn-sm hidden">
                            <span class="icon-sn-bg-facebook">
                            </span>
                        </a>
                        <a href="https://segmentfault.com/user/oauth/douban" class="btn pl5 pr5 mb5 btn-default btn-sn-douban btn-sm hidden">
                            <span class="icon-sn-bg-douban">
                            </span>
                        </a>
                    </div>
                </div>
                <div class="login-vline hidden-sm hidden-xs">
                </div>
                <div class="col-md-4 col-md-pull-3 col-sm-12 login-wrap">
                    <h1 class="h4 text-muted login-title mb30">
                        创建新账号
                    </h1>
                    <form action="<?php echo U('home/login/add');?>" method="POST"
                    role="form" class="mt30">
                        <div class="form-group">
                            <label for="name" class="control-label">
                                用户名
                            </label>
                            <input type="text" class="form-control register_form" name="username" checkdata='' required="" id='username' placeholder="字母、数字等，用户名唯一">
                            <p id="showerror"></p>
                        </div>
                        <div class="form-group">
                            <label for="mail" class="control-label">
                                Email
                            </label>
                            <input type="email" id='email' class="form-control register_form" name="email" checkdata='' required="" placeholder="hello@segmentfault.com">
                            <p id="showerror1"></p>
                        </div>
                        <div class="form-group">
                            <label for="password" class="control-label">
                                密码
                            </label>
                            <input type="password" id='pass' class="form-control register_form" name="password" checkdata='' required=""
                            placeholder="不少于 6 位">
                            <p id="showerror2"></p>
                        </div>
                        <div class="form-group">
                            <label class="required control-label" for="captcha">
                                验证码
                            </label>
                            <input type="text" checkdata='' class="form-control register_form" id="loginCaptcha" name="captcha"
                            placeholder="请输入下方的验证码">
                            <p id="showerror3"></p>
                            <div class="mt10">
                                <a id="reloadCaptcha" href="javascript:void(0)">
                                    <img class="captcha" src="<?php echo U('home/login/captcha');?>" width="240" id="bb" height="50" > 
                                </a>
                            </div>
                        </div>
                        <div class="form-group clearfix">
                            <div class="checkbox pull-left">
                                同意并接受
                                <a href="https://segmentfault.com/tos" target="_blank">
                                    《服务条款》
                                </a>
                            </div>
                            <button type="submit" class="btn btn-primary pl20 pr20 pull-right" id="submitBtn"  disabled="">
                                注册
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="text-center col-md-12 login-link">
                <a href="https://segmentfault.com/user/forgot">
                    找回密码
                </a>
                |
                <a href="https://segmentfault.com/">
                    首页
                </a>
                |
                <a href="https://segmentfault.com/user/register">
                    创建新账号
                </a>
            </div>
        </div>
        <script type="text/javascript" src='/p201604/seg/seg/Public/js/jquery.min.js'></script>
        </script>
        <script type="text/javascript">
        // 刷新验证码
        $(function (){
            $('#bb').click(function() {
                url = "<?php echo U('home/login/captcha');?>/"+Math.random();
                $(this).attr({src: url});
            });
        // 用户名验证的异步
            $('#username').blur(function(event) {
                value = $(this);
                data = $(this).val();
                $.ajax({
                    url: '<?php echo U("home/login/checkusername");?>',
                    type: 'POST',
                    dataType: 'json',
                    data: {username: data},
                })
                .done(function(data) {
                    if(data.error==1){
                        value.parent().addClass('has-error');
                        value.siblings('#showerror').html('<span class="help-block err">'+data.info+'</span>');
                    }else{
                        value.parent().removeClass('has-error');
                        $('#showerror').html('<span  >'+data.info+'</span>');
                    }
                })
            });

        // 邮箱的判断
            $('#email').blur(function(event) {
                value = $(this);
                data = $(this).val();
                $.ajax({
                    url: '<?php echo U("home/login/checkmail");?>',
                    type: 'post',
                    dataType: 'json',
                    data: {mail: data},
                })
                .done(function(data) {
                    if (data.error==1) {
                        value.parent().addClass('has-error');
                        value.siblings('#showerror1').html('<span class="help-block err">'+data.info+'</span>')
                    }else{
                        value.parent().removeClass('has-error');
                        $('#showerror1').html('<span>'+data.info+'</span>')
                    }
                })

            });
        // 密码的判断
            $('#pass').blur(function(event) {
                value = $(this);
                data = $(this).val();
                $.ajax({
                    url: '<?php echo U("home/login/checkpassword");?>',
                    type: 'POST',
                    dataType: 'json',
                    data: {password: data},
                })
                .done(function(data) {
                    if (data.error==1) {
                        value.parent().addClass('has-error');
                        value.siblings('#showerror2').html('<span class="help-block err">'+data.info+'</span>')
                    }else{
                        value.parent().removeClass('has-error');
                        $('#showerror2').html('<span>'+data.info+'</span>')
                    }
                })
            });
        // 验证码验证
            $('#loginCaptcha').blur(function(event) {
            value = $(this);
            data = $(this).val();
            $.ajax({
                url: '<?php echo U("home/login/checkcaptcha");?>',
                type: 'POST',
                dataType: 'json',
                data: {code: data},
            })
            .done(function(data) {
                if (data.error==1) {
                    value.parent().addClass('has-error');
                    value.siblings('#showerror3').html('<span class="help-block err">'+data.info+'</span>')
                }else{
                    value.parent().removeClass('has-error');
                    $('#showerror3').html('<span>'+data.info+'</span>');
                    $('#submitBtn').removeAttr('disabled');
                }
            })
            
            });

        // 解除注册的disable的属性

        $('#dmail').blur(function(event) {
            // alert(1111);
        });


        }) 
        </script>
    </body>

</html>